<%@page import="java.util.Locale"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="java.util.List"%>
<%@page import="models.ProfitDetail"%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.ArrayList"%>
<%
	List<ProfitDetail> list = (List<ProfitDetail>)request.getAttribute("result");	
	NumberFormat nf = NumberFormat.getNumberInstance(Locale.GERMAN);
	String fromDate = "";
	String toDate = "";	
	if(request.getAttribute("fromDate")!=null&&!request.getAttribute("fromDate").toString().isEmpty()){
		fromDate = (String)request.getAttribute("fromDate");		
	}
	if(request.getAttribute("toDate")!=null&&!request.getAttribute("toDate").toString().isEmpty()){
		toDate = (String)request.getAttribute("toDate");		
	}
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Báo Cáo Doanh Số Chi Tiết <%=(fromDate!=null&&!fromDate.isEmpty())?"Từ Ngày "+fromDate:""%><%=(toDate!=null&&!toDate.isEmpty())?" Đến Ngày "+toDate:""%></title>
<link rel="stylesheet" type="text/css" href="/css/simple-style.css" />
</head>
<body>
     <div class="simpleStyle">
    	<table cellpadding="0" cellspacing="0" class="simpleTable">
        	<thead>
            	<tr>
                	<th class="head1">STT</th>
                    <th class="head0">Deal Id</th>
                    <th class="head1">Tên Deal</th>	                            
                    <th class="head0">Ngày bắt đầu Deal</th>
                    <th class="head1">Ngày kết thúc</th>
                    <th class="head0">Số lượng bán</th>
                    <th class="head1">Giá nhập</th>
                    <th class="head0">Giá bán</th>
                    <th class="head1">Tổng thu dự tính</th>
                    <th class="head1">Tổng thu tiền mặt</th>
                    <th class="head0">Tổng thu chuyển khoản</th>				                                                  
                    <th class="head1">Tổng thực thu</th>
                </tr>
            </thead>
            <tbody>
            	<%
                 	if(list!=null&&list.size()>0){
                 		for(int i = 0; i< list.size();i++){
                 %>                    	
                 <tr>	                        	
					<td class="center"><%=i+1%></td>
                    <td class="center"><%=list.get(i).getDealId()%></td>
                    <td class="left"><%=list.get(i).getDealName()%></td>	                            
                    <td class="center"><%=list.get(i).getDealStartDate()%></td>
                    <td class="center"><%=list.get(i).getDealEndDate()%></td>
                    <td class="center"><%=list.get(i).getOrderQuantity()%></td>
                    <td class="center"><%=nf.format(list.get(i).getImportPrice())%></td>
                    <td class="center"><%=nf.format(list.get(i).getSellPrice())%></td>
                    <td class="center"><%=nf.format(list.get(i).getDisplayMoney())%></td>    
                    <td class="center"><%=nf.format(list.get(i).getRealMoney())%></td>
                    <td class="center"><%=nf.format(list.get(i).getBankTransferMoney())%></td>
                    <td class="center"><%=nf.format(list.get(i).getTotalMoney())%></td>                    
                  </tr>	 
                  <%
                		}
               		}
                  %>   
            </tbody>
        </table>
    </div>     
</body>
</html>